JavaScript
A5.u.objectset Method
Syntax
A5.u.object.set(object,path,value)
Arguments
- objectobjectarray
The object or array to set the value in.
- pathstringarray
The path to the value to set. If a string is passed in, the string should be formatted as it would be is accessed through javascript (for example "customer[1].name"). If an array, each subsequent entry in the array is the next leaf to access (such as ['customer',1,'name']).
- valueany
The value to set.
Description
Set a value in an object or array from the passed in path.
Example
var data = {customer: [{name: 'Bob'},{name: 'Fred'}]}; A5.u.object.set(data,'customer[1].name','Tom'); // data = {customer: [{name: 'Bob'},{name: 'Tom'}]};